package com.hhd.cwqs.qs.entity;

import cn.hutool.core.io.IoUtil;

public class Formatter {
    public static void main(String[] args) {
        String temp = IoUtil.readUtf8(Formatter.class.getClassLoader().getResourceAsStream("temp.txt"));
        String[] lines = temp.split("\\n");
        for (String line : lines) {
            String[] split = line.split("\\|");
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("| ");
            for (String s : split) {
                printString(s, 20, stringBuilder);
                stringBuilder.append("| ");
            }
            System.out.println(stringBuilder.toString().replaceAll("\\r", ""));
        }
    }

    private static void printString(String s, int i, StringBuilder stringBuilder) {
        s += "";
        stringBuilder.append(String.format("%20s ", s.replaceAll(" ", "")));
    }
}

